#ifndef OPTS_H
#define OPTS_H

#include <limits.h>

typedef enum { ZERO, NEG1, NOX } sbf_opts_eof;

typedef long          sbf_sint;
typedef unsigned long sbf_uint;

#define SBF_SINT_MIN LONG_MIN
#define SBF_SINT_MAX LONG_MAX
#define SBF_UINT_MAX ULONG_MAX

typedef struct {
  enum { BITWISE, RANGE, URANGE } typ;
  union {
    struct {
      unsigned bits : 7;
      unsigned sign : 1;
    } bitwise;
    struct {
      sbf_sint min, max;
    } range;
    struct {
      sbf_uint min, max;
    } urange;
  } val;
  char wrap;
} sbf_opts_cel;

typedef struct opts {
  sbf_opts_eof eof;
  size_t       len;
  sbf_opts_cel cel;
} sbf_opts;

#endif /* OPTS_H */
